package bairui.international.console.web.controller.personnel.employee;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.querydsl.QSort;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import com.lianjing.sh.project.config.web.Project_Config_Web_PageTemplate;
import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.module.context.ModuleContext;
import com.lianjing.sh.spring.web.controller.enhance.navigations.context.NavigationContext;
import com.querydsl.core.BooleanBuilder;

import bairui.international.console.web.controller.personnel.C_Personnel_Index_Left;
import bairui.international.service.Service_Department;
import bairui.international.service.Service_Position;


/**
 * @generated
 *
 * @see Test_C_Personnel_Employee_AddAccess 测试
 */
@Controller
public class C_Personnel_Employee_AddAccess
 extends SC_Personnel_Employee_AddAccess 
{
	
	@Autowired @Lazy private Service_Department service_Department;
	@Autowired @Lazy private Service_Position service_Position;
	
	/**
	 * 添加
	 */
	@Action(AddAccess.class)
	@GetMapping(AddAccess.RequestMappingValue)
	public ModelAndView access(
		ModelMap map, HttpServletRequest request,
		NavigationContext navigationContext, ModuleContext moduleContext
	) throws Exception {
		/* 侧边栏 */
		C_Personnel_Index_Left.importPage(map);
		/* 模块 */
		moduleContext
			.addModule(this.module_Add.module(
					new C_Personnel_Employee_Add.Add.Operate() {}, 
					service_Department.list(
						it->new BooleanBuilder(), 
						it->new QSort(it.orderValue.desc())
					).getContent(), 
					service_Position.list(
						it->new BooleanBuilder(), 
						it->new QSort(it.orderValue.desc())
					).getContent()
				));
		/* 信息 */
		return Project_Config_Web_PageTemplate.Admin_Common(request);
	}

}


